// pages/realTestGrade/realTestGrade.js
const app = getApp()
import api from '../../utils/api.js';
const API_URL = 'https://api.lailiaosheji.com/'
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },
  back(){
    wx.navigateBack({
      delta: 1
    })
  },
  redo(){
    wx.redirectTo({
      url: '/pages/realTestDetail/realTestDetail?status=3' + '&time=' + 0 ,
    })
  },
  checkErr(){
    wx.redirectTo({
      url: '/pages/myErrDetail/myErrDetail?paper_id=' + this.data.paper_id + '&type=2',
    })
  },

  //预览轮播图
  previewImage(e) {
    wx.previewImage({
      urls: [API_URL + this.data.subject_card_url]
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options)
    let obj = app.globalData.test
    this.setData({
      errorNum: options.errorNum,
      rightNum: options.rightNum,
      grade: options.grade,
      paper_id: options.paper_id,
      statusBarHeight: app.globalData.statusBarHeight,
      userInfo: app.globalData.userInfo,

      type: obj.type,
      // paper_id: obj.paper_id,
      totalNum: obj.totalNum,
      timing: obj.timing,
      name: obj.name,
      paper_name: obj.paper_name,
      subjectNum: obj.subjectNum,
      paper_category_id: obj.paper_category_id,
    })

    api.POST('applet/ContactService/detail',{},res=>{
      console.log(res)
      this.setData({
        subject_url: res.data.subject_url,
        subject_card_url: res.data.subject_card_url
      })
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})